
function handleRequest(method , url , data , $http , $q){
	var defered = $q.defer();

	var config = {
		method : method,
		url : url
	};

	if('POST' == method){
		config.data = data;
	}else if('GET' == method){
		config.params = data;
	}
	$http(config).success(function(result){
		defered.resolve(result);
	}).error(function(err){
		defered.reject(err);
	});
	return defered.promise;

};

function messageMinErr(errText , fn , timeout){
	var timeout = timeout ? timeout : 8 , wh = window.screen.height;
	var opcing = document.createElement('DIV');
	opcing.setAttribute('class','opcingErrBox');
	opcing.innerHTML = errText;
    var hh = wh / 2 - 41;
    document.body.appendChild(opcing);
    var _t = 0;
    function startHide(){
        opcing.style.opacity = '.' + timeout;
		opcing.style.filter = 'alpha(opacity='+timeout+'0)';		
        if(timeout <= 0){
            document.body.removeChild(opcing);
            if(fn && typeof fn === 'function'){
                fn();
            }
        }else{
            setTimeout(startHide , 200);
        }
        timeout--;
    }
    var maxH = wh * 0.45;
    window.intervalObj = setInterval(function(){
    	opcing.style.top = _t + 'px';
    	_t+=10;
    	if(_t > maxH){
    		_t=0;
    		startHide();
    		clearInterval(window.intervalObj);
    	}
    },2);
}